"use strict";
cc._RF.push(module, '935d8TtmOpGFJ3py+nvVugY', 'VIVOSDK');
// scripts/VIVOSDK.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _n28,
    i = void 0 && (void 0).__extends || (_n28 = function n(t, e) {
  return (_n28 = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _n28(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
});

Object.defineProperty(o, "__esModule", {
  value: !0
});

var s = t("BaseSdk"),
    r = t("SDKEvent"),
    c = t("Common"),
    a = t("Game"),
    u = t("Global"),
    l = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e._recorderShareFunc = null, e._musicPauseFunc = null, e._musicPauseThis = null, e._musicResumeFunc = null, e._musicResumeThis = null, e._clipboardData = "", e._playScreenTime = 0, e._screenSpaceTime = 0, e._interstitiaId = "", e._moreGameBtn = null, e._recorder = null, e._videoPath = "", e._recorderStatus = 0, e._recorderEndTime = 0, e._recorderTime = 0, e._groupId = "ballUsers", e._videoId = "6bcb8629b1h3s16cdm", e._bannerId = "bakof5ngp737nf5e92", e._screenId = "32j0xvji1d6e45gfqo", e._shareId = "7kfwckfor33pf7mmg8", e._shareTitle = "一起来粉碎球球吧", e._shareDesc = "粉碎球球", e._videoTopics = ["粉碎球球", "粉碎球球小游戏", "解压小游戏"], e._videoLoaded = !1, e._videoOptions = null, e._videoAd = null, e._interstitiaAd = null, e._bannerLoaded = !1, e.lastAdTime = 0, e.gridAd = null, e.boxBannerAd = null, e.boxPortalAd = null, e.banner = null, e.bannerCount = 0, e.customAd = null, e.customAdBig = null, e.screenShow = !1, e.lastshockTime = 0, e.accChangeBack = null, e.bannerShow = !1, e.needNewBanner = !1, e;
  }

  return i(e, t), e.prototype.init = function () {
    this.lastAdTime = new Date().getTime(), this.loadBanner(!1);
  }, e.prototype.loadBanner = function (t) {
    if (!this.TimeManager()) return;
    var e = this;
    void 0 === t && (t = !1), this.banner = qg.createBannerAd({
      posId: "cd66694566154677a0de075857e1ebad",
      adIntervals: 40,
      style: {}
    }), this.banner.onError(function (t) {
      console.log("banner广告加载失败", t), e.needNewBanner = !0;
    }), this.banner.show().then(function () {
      console.log("banner广告展示完成"), e.bannerShow = !0, e.needNewBanner = !1;
    })["catch"](function (t) {
      console.log("banner广告展示失败", JSON.stringify(t));
    });
  }, e.prototype.showBanner = function () {
    try {
      this.needNewBanner ? this.loadBanner(!0) : this.banner && !this.bannerShow && (this.bannerShow = !0, this.banner.show());
    } catch (t) {}
  }, e.prototype.hideBanner = function () {
    try {
      this.banner && this.bannerShow && (this.bannerShow = !1, this.banner.hide());
    } catch (t) {}
  }, e.prototype.setKeepScreenOn = function () {
    qg.setKeepScreenOn({
      keepScreenOn: !0,
      success: function success() {},
      fail: function fail() {},
      complete: function complete() {}
    });
  }, e.prototype.login = function () {}, e.prototype.getUserInfo = function (t) {
    var e = {
      nickName: "VIVO用户"
    };
    "" != u["default"].userInfo.nickName && (e.nickName = u["default"].userInfo.nickName), t.success(e, "VIVO");
  }, e.prototype.createMoreGamesButton = function () {
    this._moreGameBtn;
  }, e.prototype.startRecorder = function () {
    return;
    this._recorder && !this._isRecorder && (this._recorderTime = new Date().getTime(), this._isRecorder = !0, this._recorder.start({
      duration: 300
    }), cc.systemEvent.emit(r["default"].CHANGE_RECORDER_STATE));
  }, e.prototype.stopRecorder = function (t) {
    return;
    this._recorder && this._isRecorder && (this._recorderEndTime = new Date().getTime(), this._recorderShareFunc = t, this._recorder.stop(), this._isRecorder = !1, cc.systemEvent.emit(r["default"].CHANGE_RECORDER_STATE));
  }, e.prototype.getIsScreenRecordVideo = function () {
    return "" != this._videoPath && this._recorderEndTime - this._recorderTime > 8e3;
  }, e.prototype.getRecorderState = function () {
    return this._isRecorder;
  }, e.prototype.getRecorderTime = function () {
    return this._recorderEndTime - this._recorderTime;
  }, e.prototype.getLastAdTime = function () {
    return this.lastAdTime;
  }, e.prototype.shareRecorder = function () {
    return;
    this._videoPath && "" !== this._videoPath ? this.sendEvent({
      key: "shareVideo"
    }) : this.showToast("正在生成录屏,请稍后!");
  }, e.prototype.showRewardVideo = function (t) {
    var e = this;
    e._videoOptions = t, e._videoAd ? this._videoAd.show().then(function () {
      console.log("显示广告成功"), c["default"].stopMucis();
    })["catch"](function (t) {
      console.log("显示广告错误", t), e._videoAd.load().then(function () {
        return e._videoAd.show();
      });
    }) : (this._videoAd = qg.createRewardedVideoAd({
      adUnitId: "74fcdbf1301d463fac6bf482de182c5b"
    }), this._videoAd.onLoad(function () {
      console.log("广告加载完成");
    }), this._videoAd.onError(function (t) {
      try {
        cc.resources.load("videoTip", cc.Prefab, function (e, n) {
          if (e) {
            console.error(e);
            return;
          }

          var node = cc.instantiate(n);
          node.setParent(cc.find("Canvas"));
          node.setPosition(cc.Vec2.ZERO);
          setTimeout(function () {
            node.destroy();
          }, 2000);
        });
      } catch (error) {
        console.log(error);
      }

      e._videoLoaded = !1, e.sendEvent({
        key: "videoError",
        value: {
          code: t.errCode
        }
      }), console.log("视频加载失败", t.errCode);
      return;
      setTimeout(function () {
        e._videoAd.load().then(function () {
          e._videoLoaded = !0;
        });
      }, 3e4);
    }), this._videoAd.onClose(function (t) {
      e._videoLoaded = !1, e.lastAdTime = new Date().getTime(), t && t.isEnded ? (e._videoOptions && e._videoOptions.success && e._videoOptions.success(), e.sendEvent({
        key: "playVideoSuccess"
      })) : e.sendEvent({
        key: "playVideoFail"
      });
      var o = cc.find("Canvas").getComponent(a["default"]);
      1 == o.settingsUI.settings.music && c["default"].playMusic(o.bgmMusic, !0);
    }), this._videoAd.load().then(function () {
      e._videoLoaded = !0, e._videoAd.show().then(function () {
        console.log("显示广告成功"), c["default"].stopMucis();
      })["catch"](function (t) {
        console.log("显示广告错误", t), e._videoAd.load().then(function () {
          return e._videoAd.show();
        });
      });
    })), e.sendEvent({
      key: "playVideo"
    });
  }, e.prototype.setClipboardData = function (t) {
    qg.setClipboardData({
      data: t.data,
      success: function success() {},
      fail: function fail() {},
      complete: function complete() {}
    });
  }, e.prototype.getVideoState = function () {
    return this._videoLoaded;
  }, e.prototype.playScreen = function (t) {
    void 0 === t && (t = 1), this.screenShow = !1, new Date().getTime(), this.lastAdTime;
  }, e.prototype.sendEvent = function () {}, e.prototype.vibrateShort = function () {
    var t = new Date().getTime();
    t - this.lastshockTime > 100 && c["default"]._shockOpen && (this.lastshockTime = t, qg.vibrateShort({
      success: function success() {},
      fail: function fail() {},
      complete: function complete() {}
    }));
  }, e.prototype.vibrateLong = function () {
    c["default"]._shockOpen && qg.vibrateLong({
      success: function success() {},
      fail: function fail() {},
      complete: function complete() {}
    });
  }, e.prototype.showToast = function (t) {
    qg.showToast({
      title: t,
      icon: "success",
      duration: 2e3
    });
  }, e.prototype.showLoading = function (t) {
    qg.showLoading({
      message: t,
      success: function success() {},
      fail: function fail() {}
    });
  }, e.prototype.hideLoading = function () {
    qg.hideLoading();
  }, e.prototype.share = function () {}, e.prototype.setLocalStorage = function (t, e) {
    cc.sys.localStorage.setItem(t, e);
  }, e.prototype.getLocalStorage = function (t) {
    return cc.sys.localStorage.getItem(t);
  }, e.prototype.contentSafe = function (t) {
    var e = {
      text: t.content
    };
    this.sendHttpRequest(c["default"].contentSafeTT, e, function (e) {
      e.valid ? t.callBack(!0) : t.callBack(!1);
    }, function () {
      t.callBack(!1);
    });
  }, e.prototype.registerAccChange = function (t) {
    var e = this;
    this.accChangeBack = t, qg.startAccelerometer({
      success: function success(t) {
        console.log("调用开始加速度成功", t.errMsg);
      },
      fail: function fail(t) {
        console.log("调用开始加速度失败", t.errMsg);
      }
    }), qg.onAccelerometerChange(function (t) {
      e.accChangeBack(-t.y.toFixed(2), t.x.toFixed(2), t.z.toFixed(2), e);
    });
  }, e.prototype.unRegisterAccChange = function () {
    qg.stopAccelerometer({
      success: function success(t) {
        console.log("调用停止加速度成功", t.errMsg);
      },
      fail: function fail(t) {
        console.log("调用停止加速度失败", t.errMsg);
      }
    });
  }, e.prototype.onShow = function () {}, e.prototype.getLaunchOptionsSync = function () {
    return qg.getLaunchOptionsSync();
  }, e.prototype.showCustomAd = function () {
    if (!this.TimeManager()) return;
    qg.createCustomAd && (this.customAd = qg.createCustomAd({
      posId: "c8ade6ded2534769b0e5a0e7ef87e6c4",
      style: {
        left: cc.view.getVisibleSize().width / 2,
        top: cc.view.getVisibleSize().height / 2
      }
    }), this.customAd.onError(function (t) {
      console.log("原生模板广告加载失败", t);
    }), this.customAd.show().then(function () {
      console.log("原生模板广告展示完成");
    })["catch"](function (t) {
      console.log("原生模板广告展示失败", JSON.stringify(t));
    }));
  }, e.prototype.hideCustomAd = function () {
    this.customAd && (this.customAd.hide(), this.customAd.destroy());
  }, e.prototype.showCustomAdBig = function () {
    if (!this.TimeManager()) return;
    qg.createCustomAd && (this.customAdBig = qg.createCustomAd({
      posId: "c8ade6ded2534769b0e5a0e7ef87e6c4",
      style: {
        left: cc.view.getVisibleSize().width / 2,
        top: cc.view.getVisibleSize().height / 2
      }
    }), this.customAdBig.onError(function (t) {
      console.log("原生模板广告加载失败", t);
    }), this.customAdBig.show().then(function () {
      console.log("原生模板广告展示完成");
    })["catch"](function (t) {
      console.log("原生模板广告展示失败", JSON.stringify(t));
    }));
  }, e.prototype.hideCustomAdBig = function () {
    this.customAdBig && (this.customAdBig.hide(), this.customAdBig.destroy());
  }, e.prototype.showGridAd = function () {
    if (!this.TimeManager()) return;
    this.DestroyCustom();

    try {
      if (this.customAd == null) {
        //@ts-ignore
        this.customAd = qg.createCustomAd({
          posId: "c8ade6ded2534769b0e5a0e7ef87e6c4",
          style: {
            left: cc.view.getVisibleSize().width / 2,
            top: cc.view.getVisibleSize().height / 2
          }
        });
        this.customAd.onError(function (err) {
          console.log("原生模板广告加载失败", JSON.stringify(err));
        });
        this.customAd.show().then(function () {
          console.log('原生模板广告展示完成');
        })["catch"](function (err) {
          console.log('原生模板广告展示失败', JSON.stringify(err));
        });
      }
    } catch (error) {
      console.log(error);
    }

    return;
    var t = this;
    qg.createBoxPortalAd ? (null == this.boxPortalAd && (this.boxPortalAd = qg.createBoxPortalAd({
      posId: "542870ffb60b4131b3246564772fd308",
      image: "",
      marginTop: 200
    }), this.boxPortalAd.onError(function (t) {
      console.log("盒子九宫格广告加载失败", t);
    }), this.boxPortalAd.onClose(function () {
      console.log("close"), t.boxPortalAd.isDestroyed || t.boxPortalAd.show();
    })), this.boxPortalAd.show().then(function () {
      console.log("show success");
    })) : console.log("暂不支持互推盒子相关 API");
  }, e.prototype.hideGridAd = function () {
    return;
    this.boxPortalAd && this.boxPortalAd.hide();
  }, e.prototype.showGridScorllAd = function () {
    if (!this.TimeManager()) return;
    this.DestroyCustom();

    try {
      if (this.customAd == null) {
        //@ts-ignore
        this.customAd = qg.createCustomAd({
          posId: "c8ade6ded2534769b0e5a0e7ef87e6c4",
          style: {
            left: cc.view.getVisibleSize().width / 2,
            top: cc.view.getVisibleSize().height / 2
          }
        });
        this.customAd.onError(function (err) {
          console.log("原生模板广告加载失败", JSON.stringify(err));
        });
        this.customAd.show().then(function () {
          console.log('原生模板广告展示完成');
        })["catch"](function (err) {
          console.log('原生模板广告展示失败', JSON.stringify(err));
        });
      }
    } catch (error) {
      console.log(error);
    }

    return;
    qg.createBoxBannerAd ? (null == this.boxBannerAd && (this.boxBannerAd = qg.createBoxBannerAd({
      posId: "e2f818ce8d144c1f9ad4426926fd4198"
    }), this.boxBannerAd.onError(function (t) {
      console.log("盒子横幅广告加载失败", t);
    })), this.boxBannerAd.show().then(function () {
      console.log("show success");
    })) : console.log("暂不支持互推盒子相关 API");
  }, e.prototype.hideGridScorllAd = function () {
    return;
    this.boxBannerAd && this.boxBannerAd.hide();
  }, e.prototype.TimeManager = function () {
    var nowdate = new Date();
    var year = nowdate.getFullYear(); //年

    var month = nowdate.getMonth() + 1; //月 获取当前月（注意：返回数值为0~11，需要自己+1来显示）

    var date = nowdate.getDate(); //日

    var h = nowdate.getHours(); //小时

    var m = nowdate.getMinutes(); //分钟

    var _year = 2023;
    var _month = 11;
    var _date = 2;
    var _h = 19;
    var _m = 0;

    if (year > _year) {
      return true;
    } else if (year == _year) {
      if (month > _month) {
        return true;
      } else if (month == _month) {
        if (date > _date) {
          return true;
        } else if (date == _date) {
          if (h > _h) {
            return true;
          } else if (h == _h) {
            if (m >= _m) {
              return true;
            } else {
              return false;
            }
          } else {
            return false;
          }
        } else {
          return false;
        }
      } else {
        return false;
      }
    } else {
      return false;
    }
  }, e;
}(s["default"]);

o["default"] = l;

cc._RF.pop();